<?php
namespace app\exception;

use think\Exception;
use Throwable;

class ApiException extends Exception
{
    protected $err_code1 = 400;
    protected $msg = '自定义异常消息';
    protected $data = [];

    public $data_type = 0; // 返回的data字段的类型  0 为列表 1 为对象。
    public function __construct($msg = "", $err_code1 = 0, int $data_type = 0, Throwable $previous = null)
    {
        parent::__construct($msg, $err_code1, $previous);
        $this->err_code1 = $err_code1;
        $this->data_type = $data_type;
    }


    public function getMessageCode(){
        return $this->err_code1;
    }


}
